///**
// * Created with JetBrains WebStorm.
// * User: scb
// * Date: 17/4/13
// * Time: 10:56 AM
// * To change this template use File | Settings | File Templates.
// */
//
//describe("LocateNearestAtmBranchController",function(){
//    var locateNearestAtmBranchController = null;
//    var channelType, placemarks;
//    var listData = [];
//    var position = {};
//    beforeEach(function(){
//        channelType = "atm";
//        placemarks = {
//            all : [{}],
//            atm : [
//                {channel:[{latitude:"", longitude:""}],channels:[{latitude:"", longitude:""}]},
//                {channel:[{latitude:"", longitude:""}],channels:[{latitude:"", longitude:""}]},
//                {channel:[{latitude:"", longitude:""}],channels:[{latitude:"", longitude:""}]}
//            ],
//            branch : [
//                {channel:[{latitude:"", longitude:""}],channels:[{latitude:"", longitude:""}]},
//                {channel:[{latitude:"", longitude:""}],channels:[{latitude:"", longitude:""}]},
//                {channel:[{latitude:"", longitude:""}],channels:[{latitude:"", longitude:""}]}
//            ]
//        };
//        locateNearestAtmBranchController = App.LocateNearestAtmBranchController.create();
//    })
//
//    it("prepareController", function(){
//        App.RouteHistory.lastRoute= "publicLocate";
//
//        spyOn(App.api_locate, "getNearestPlacemarks").andReturn(placemarks);
//        spyOn(locateNearestAtmBranchController, "get").andReturn(listData);
//        spyOn(locateNearestAtmBranchController,"prepareAtmBranchList");
//
//        locateNearestAtmBranchController.prepareController(channelType);
//        expect(locateNearestAtmBranchController.get).toHaveBeenCalled();
//        expect(App.api_locate.getNearestPlacemarks).toHaveBeenCalledWith(locateNearestAtmBranchController.get("position"),3);
//        expect(locateNearestAtmBranchController.prepareAtmBranchList).toHaveBeenCalledWith(placemarks,channelType);
//    })
//
//    describe("prepareAtmBranchList",function(){
//        var atmList = [];
//        var branchList = [];
//
//        it("prepareAtmBranchList; channelType = atm", function(){
//            spyOn(locateNearestAtmBranchController.get('listData'),"pushObject");
//            locateNearestAtmBranchController.prepareAtmBranchList(placemarks,channelType);
//            expect(locateNearestAtmBranchController.get('listData').pushObject).toHaveBeenCalled();
//        })
//
//        it("prepareAtmBranchList; channelType = branch", function(){
//            channelType = "branch";
//            spyOn(locateNearestAtmBranchController.get('listData'),"pushObject");
//            locateNearestAtmBranchController.prepareAtmBranchList(placemarks,channelType);
//            expect(locateNearestAtmBranchController.get('listData').pushObject).toHaveBeenCalled();
//        })
//
//        it("prepareAtmBranchList; failed case", function(){
//            channelType = "nil";
//            spyOn(locateNearestAtmBranchController.get('listData'),"pushObject");
//            locateNearestAtmBranchController.prepareAtmBranchList(placemarks,channelType);
//            expect(locateNearestAtmBranchController.get('listData').pushObject).not.toHaveBeenCalled();
//        })
//    })
//
//    describe("selectItem", function(){
//        var channel;
//        var obj;
//        beforeEach(function(){
//            channel = App.Channel.create();
//            obj = {
//                channel: channel,
//                position: locateNearestAtmBranchController.get("position")
//            };
//        })
//
//        it("selectItem; if branch", function(){
//            App.set("currentLocateState", "securityLocate");
//            spyOn(locateNearestAtmBranchController, "transitionTo");
//            locateNearestAtmBranchController.selectItem(channel);
//            expect(locateNearestAtmBranchController.transitionTo).toHaveBeenCalledWith('securityLocate.map', obj);
//        })
//
//        it("selectItem; else branch", function(){
//            App.set("currentLocateState", "publicLocate");
//            spyOn(locateNearestAtmBranchController, "transitionTo");
//            locateNearestAtmBranchController.selectItem(channel);
//            expect(locateNearestAtmBranchController.transitionTo).toHaveBeenCalledWith('publicLocate.map', obj);
//        })
//    })
//
//
//})
